package com.ukao.pad.adapter;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.pad.R;
import com.ukao.pad.consts.Constant;
import com.ukao.pad.widget.StateImageView;

import java.util.List;

/**
 * Created by ukaodev on 2017/7/19.
 */

public class HomeAdapter extends CommonAdapter<String> {



    public HomeAdapter(Context context, List<String> datas) {
        super(context, datas, R.layout.adapter_home_fragment);
    }

    @Override
    public void convert(ViewHolder holder, String testBean) {
        StateImageView   itemicon=holder.getView(R.id.item_home_fragment_itemicon);
        TextView   itemname=holder.getView(R.id.item_home_fragment_itemname);
        itemname.setText(testBean);
        Drawable normal;
        Drawable pressed;
        Resources mResources=mContext.getResources();
        normal =mResources.getDrawable(Constant.mHomePressedIcons[holder.getLayoutPosition()]);
        pressed=mResources.getDrawable(Constant.mHomeNormalIcons[holder.getLayoutPosition()]);
        itemicon.setStateBackground(pressed,normal,normal);

    }

}
